package com.aliyeye.controller;

import com.aliyeye.bean.User;
import com.aliyeye.config.DataSourceProperties;
import com.aliyeye.config.PersonProperties;
import com.aliyeye.sevice.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;

/**
 * @version V999
 * @package com.aliyeye.controller
 * @description: 来自三年开发经验，月薪100k，大佬代码
 * @author: 痞子洋
 * @date: 2019/6/9 15:58
 */
@RestController
public class HelloController {
   /* @Autowired
    private DataSourceProperties dataSource;
    @Autowired
    // @Qualifier("datasource2")
    private DataSource dataSource2;*/

    @Autowired
    private PersonProperties person;
    @Autowired
    private IUserService userService;

    @GetMapping("/hello")
    public String hello() {
        //System.out.println(dataSource);
       // System.out.println(dataSource2);
        System.out.println(person);
        return "hello springboot!";
    }

    @GetMapping("user/{id}")
    public User queryUserById(@PathVariable("id") Long id) {
        System.out.println(id);
        return userService.queryUserById2(id);

    }

}
